home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS25.ADF / DiskWipe / execsup.c < prev    next >
C/C++ Source or Header  |  1989-01-26  |  1KB  |  47 lines

  1. #include "diskwipe.h"
  2.  
  3. struct MsgPort *NewPort()
  4. {
  5.    UBYTE sigbit;
  6.    struct MsgPort *port;
  7.  
  8.    if ((sigbit = AllocSignal(-1)) == -1)
  9.       return(NULL);
  10.  
  11.    if ((port = (struct MsgPort *)
  12.                AllocMem((ULONG)sizeof(struct MsgPort),
  13.                         MEMF_CLEAR|MEMF_PUBLIC)) == NULL)
  14.       {
  15.       FreeSignal(sigbit);
  16.       return(NULL);
  17.       }
  18.  
  19.    port->mp_Node.ln_Type = NT_MSGPORT;
  20.    port->mp_Flags        = PA_SIGNAL;
  21.    port->mp_SigBit       = sigbit;
  22.    port->mp_SigTask      = FindTask(0);
  23.    NewList(&(port->mp_MsgList));
  24.    return(port);
  25. }
  26.  
  27. void DisposePort(port)
  28. struct MsgPort *port;
  29. {
  30.    FreeSignal(port->mp_SigBit);
  31.    FreeMem((char *)port, (ULONG)sizeof(*port));
  32. }
  33.  
  34. struct IOExtTD *CreateIOExtTD(mp)
  35. struct MsgPort *mp;
  36.    {
  37.    struct IOExtTD *ioext;
  38.    if ((ioext = (struct IOExtTD *)
  39.                 AllocMem(sizeof(struct IOExtTD),
  40.                          MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
  41.       {
  42.       ioext->iotd_Req.io_Message.mn_Node.ln_Type = NT_MESSAGE;
  43.       ioext->iotd_Req.io_Message.mn_ReplyPort = mp;
  44.       }
  45.    return(ioext);
  46.    }
  47.